#include <stdio.h>
#include <arpa/inet.h>

int main()
{
    unsigned int a_h = 0x01020304;
    uint32_t a_n;
    //将主机字节序的a_h转换为网络字节序的a_n
    a_n = htonl(a_h);
    printf("主机字节序下：%#x\n",a_h);
    printf("网络字节序下：%#x\n",a_n);
    return 0;
}